trigger MyFunTrigger on Foobar__c (before insert) {

    sObject[] obs = Trigger.new;
    Foobar__c f = (Foobar__c)obs[0];
    if ( f.MyRequiredField__c== null ) {
        f.MyRequiredField__c= 'trig set';
    }
}